package com.demo.web;

import java.io.IOException;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.demo.entity.Bbs;
import com.demo.server.BbsServer;
import com.demo.web.base.BaseResult;
import com.jweb.annotaion.JAutowired;
import com.jweb.annotaion.JController;
import com.jweb.annotaion.JParam;
import com.jweb.core.handle.Controller;

/**
 * 7论坛
 * 
 * @author Yuan
 */
@JController("/bbs")
public class BBSController extends Controller {
	public void init() {
		setAttr("menutag", 7);
	}

	@JAutowired
	public BbsServer server;

	/**
	 * 当前页，版块，排序类型
	 */
	public void BBSManager(@JParam("${1}") int curPage, @JParam("${2}") int bbsType, @JParam("${3}") int order) {
		List<Map<String, String>> listType = server.listBbsType();
		BaseResult<Map<String, String>> result = server.listBbs(curPage, bbsType, order);
		
		setAttr("bbsType", listType);
		setAttr("curType", bbsType);
		setAttr("curOrder", order);
		setAttr("curPage", curPage);
		setAttr("result", result);
	}

	public void BBSInfo() {

	}

	public void ueditAction(HttpServletRequest req, HttpServletResponse res) throws IOException {

	}

}
